<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>

    <script th:src="@{/webjars/jquery/3.3.0/jquery.min.js}"></script>
    <link th:href="@{/webjars/bootstrap/3.3.7/css/bootstrap.min.css}" rel="stylesheet"/>
    <script th:src="@{/webjars/bootstrap/3.3.7/js/bootstrap.min.js}"></script>
    <link th:href="@{/css/list.css}" rel="stylesheet"/>
    <title>list</title>
</head>
<body>
    <div class="container">
        <div id="query">
        <form  action="/user/query" method="post">
            <div class="input-group">
            <input type="text" class="form-control" placeholder="username" name="name" style="display: inline" />
            <span class="input-group-btn">
                <input type="submit" class="btn btn-primary" value="查询"/>
            </span>
            </div>
        </form>
        </div>
        <form action="/user/findAll" method="post">
            <input type="submit" class="btn btn-info" value="查询所有"/>
        </form>
        <div class="row">
            <div class="col-md-12 col-md-offset-1">
                <div class="col-md-10">
                    <table class="table table-striped table-bordered">
                        <thead>
                            <th>编号</th>
                            <th>姓名</th>
                            <th>密码</th>
                            <th>邮箱</th>
                            <th>年龄</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                        <tr th:each="user:${users}">
                            <td th:text="${user.id}">dd</td>
                            <td th:text="${user.name}">dd</td>
                            <td th:text="${user.password}">dd</td>
                            <td th:text="${user.email}">dd</td>
                            <td th:text="${user.age}">dd</td>

                            <td>
                                <form action="/user/update"
                                      th:action="@{/user/update(id=${user.id},name=${user.name},password=${user.password},email=${user.email},age=${user.age})}"
                                      method="post" style="display: inline">
                                    <input type="submit" class="bt btn-primary btn-xs" value="修改"/>
                                </form>
                                <!--<a href="#"
                                   th:href="@{/user/update(id=${user.id})}"
                                   class="bt btn-primary btn-xs">修改</a>-->
                                <span>&nbsp;&nbsp;</span>
                                <a href="#" th:href="@{/user/delete(id=${user.id})}" class="btn btn-danger btn-xs">删除</a>
                                <span>&nbsp;&nbsp;</span>
                                <a href="#" th:href="@{/addUser}" class="btn btn-danger btn-xs">添加</a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</body>
</html>